<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<title>09-y模式匹配符</title>
	<style type="text/css">
	* {
		padding: 0;
		margin: 0;
	}
	span.red{
		color: red;
	}
    </style>
</head>
<body>
	<div class="container" id="container">
		<h1>09-y模式匹配符</h1> 
		<p> </p>
	</div>
	<script src="../tools/utils.js"></script>
	<script type="text/javascript">
	var hd = "bbbuudunren";
	var reg = /u/g;
	console.log(reg.exec(hd));
	console.log(reg.lastIndex); //3
	console.log(reg.exec(hd));
	console.log(reg.lastIndex); //3
	console.log(reg.exec(hd)); //null
	console.log(reg.lastIndex); //0

	console.log(reg.exec(hd)); //null
	console.log(reg.lastIndex); //0
	console.log('---------------------------------\n')
	
	var reg = /u/
	console.warn(hd.match(reg))
	var reg = /u/y
	reg.lastIndex = 3
	console.log(reg.exec(hd));
	console.log(reg.lastIndex); //3
	console.log(reg.exec(hd));
	console.log(reg.lastIndex); //3
	console.log(reg.exec(hd));
	console.log(reg.lastIndex); //3
	
	</script>
</body>
</html>